Ext.ns("Ext.ux.menu");

Ext.ux.menu.DatetimeMenu = function(config){
    Ext.ux.menu.DatetimeMenu.superclass.constructor.call(this, config);  
    this.plain = true;
    var di = new Ext.ux.menu.DatetimeItem(config);
    this.add(di);
    /**
     * The {@link Ext.ux.DatetimePicker} instance for this DateMenu
     * @type DatePicker
     */
    this.picker = di.picker;
    /**
     * @event select
     * @param {DatetimePicker} picker
     * @param {Date} date
     */
    this.relayEvents(di, ["select"]);

    this.on('beforeshow', function(){
        if(this.picker){
            this.picker.hideMonthPicker(true);
            this.picker.hideTimePicker(true);
        }
    }, this);
}; 
Ext.extend(Ext.ux.menu.DatetimeMenu, Ext.menu.Menu, {
    cls:'x-date-menu',

    // private
    beforeDestroy : function() {
        this.picker.destroy();
    }
});